<template>
  <div>
       <el-form
      :model="formData"
      inline
      style="display: flex; justify-content: flex-end; margin-top: 10px"
    >
      <el-form-item prop="username">
        <el-input
          v-model="formData.username"
          placeholder="请输入用户名"
        ></el-input>
      </el-form-item>

      <el-form-item prop="id">
        <el-input
          v-model="formData.id"
          placeholder="请输入id"
        ></el-input>
      </el-form-item>

      <el-form-item>
        <el-button @click="getBack" type="primary" icon="el-icon-search">查找</el-button>
      </el-form-item>
    </el-form>

 <el-table v-loading='BackLoading' :data="BackData" border>
   <el-table-column align="center" label="反馈id" prop="id"></el-table-column>
   <el-table-column align="center" label="用户名" prop="username"></el-table-column>
   <el-table-column align="center" label="手机号码" prop="mobile"></el-table-column>
   <el-table-column align="center" label="反馈类型" prop="feedType"></el-table-column>
   <el-table-column align="center" label="反馈内容" prop="content"></el-table-column>
   <el-table-column align="center" label="反馈图片" prop="picUrls"></el-table-column>
   <el-table-column align="center" label="时间" prop="addTime"></el-table-column>
 </el-table>

    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageInfo.page"
      :page-sizes="[1, 20, 30, 50, 100]"
      :page-size="pageInfo.limit"
      background
      layout="total, sizes, prev, pager, next, jumper"
      :total="pageInfo.total"
    >
    </el-pagination>
  </div>
</template>
  
<script>
import axios from 'axios'
export default {
  name: 'feedback',
  componentTitle: '意见反馈',
  data () {
    return {
      BackLoading:false,
      BackData:[],
      pageInfo:{
         page:1,
        limit:10,
        total:0
      },
      formData:{
          username:'',
          id:''
      }
    }
  },
  mounted(){
    this.getBack()
  },
  methods:{
    getBack(){
      this.BackLoading=true

      axios({
        url: 'http://192.168.200.251:8888/admin/feedback/list',
        method:'get',
        params:{
            page:this.pageInfo.page,
          limit:this.pageInfo.limit,
         ...this.formData
        },
            headers: {
          "shopping-admin-token": sessionStorage.getItem(
            "shopping-admin-token"
          ),
          }
      }).then(res=>{
        this.BackLoading=false
        this.BackData=res.data.data.list
        this.pageInfo.total=res.data.data.total
      })
    },
     handleSizeChange(value){
      this.pageInfo.limit=value
      this.getHistory()
    },
    handleCurrentChange(value){
      this.pageInfo.page=value
      this.getHistory()
    }
  }
}
</script>

